package com.api.core.domain.query.score;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

@Data
public class ElementScoreQuery {
    private Long elementId;
    //    private String elementName;
    private JSONObject localElementName;
    private final String type = "element";
    private List<Double> score;
    private List<DatColScoreQuery> children;

    public void setLocalElementName(String localElementName) {
        if (StringUtils.isNotBlank(localElementName)) {
            this.localElementName = JSONObject.parseObject(localElementName);
        } else {
            this.localElementName = null;
        }
    }

    public void setScore(String strScore) {
        if (StringUtils.isNotBlank(strScore)) {
            this.score = JSONArray.parseArray(strScore).toList(Double.class);
        }
    }
}
